<?php

namespace App\Models\Api;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use App\Models\Api\Base;

class WeeklyHoroscope extends Base
{
    use HasFactory;
    protected $table = 'weekly_horoscope';

    protected $fillable = [
        'zodiac_sign_id', 'title', 'introduction', 'content'
    ];

    public function zodiacSign()
    {
        return $this->belongsTo(ZodiacSign::class);
    }
    
     public function getZodiacSignNameAttribute()
    {
        $signs = [
            1 => '白羊座',
            2 => '金牛座',
            3 => '双子座',
            4 => '巨蟹座',
            5 => '狮子座',
            6 => '处女座',
            7 => '天秤座',
            8 => '天蝎座',
            9 => '射手座',
            10 => '摩羯座',
            11 => '水瓶座',
            12 => '双鱼座'
        ];

        return $signs[$this->zodiac_sign_id] ?? '未知';
    }
    
}
